package com.jic.market.mapper.overlay;

import com.jic.market.entity.overlay.OverlayGroupInfo;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 叠加规则组信息表
 *
 * @author : seven
 * @version : v1.0.0
 * @email : 774329481@qq.com
 * @since : 2020-03-20 04:47:43
 */
@Repository
public interface OverlayGroupInfoMapper {

    long insert(OverlayGroupInfo overlayGroupInfo);

    long delete(@Param("overlayId") String overlayId);

    long update(OverlayGroupInfo overlayGroupInfo);

    OverlayGroupInfo queryByPrimaryKey(Long id);

    List<OverlayGroupInfo> query(OverlayGroupInfo overlayGroupInfo);

    List<OverlayGroupInfo> queryPage(@Param("startIndex") int startIndex, @Param("limit") int limit,
                                     @Param("overlayGroupInfo") OverlayGroupInfo overlayGroupInfo);

    long queryPageCount(OverlayGroupInfo overlayGroupInfo);

    @Select("select * from market_overlay_group_info where overlay_id=#{overlayId} and delete_flag='0'")
    List<OverlayGroupInfo> queryGroupList(@Param("overlayId")String overlayId);

    @Update("update market_overlay_group_info set full_amount_reduce_flag=#{fullAmountReduceFlag} " +
            "where overlay_id=#{overlayId} and overlay_group_id=#{overlayGroupId} and delete_flag='0'")
    long updateFullAmountReduceFlag(@Param("fullAmountReduceFlag")String fullAmountReduceFlag,
                                    @Param("overlayId")String overlayId,
                                    @Param("overlayGroupId")String overlayGroupId);
}